package cn.hnucm.searchesservice.service.impl;

import cn.hnucm.searchesservice.dao.TbGoodsImageDao;
import cn.hnucm.searchesservice.entity.TbGoodsImage;
import cn.hnucm.searchesservice.service.TbGoodsImageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 账单明细 服务实现类
 * </p>
 *
 * @author chenjintao
 * @since 2021-12-20
 */
@Service
public class TbGoodsImageServiceImpl implements TbGoodsImageService {

    @Autowired
    @Qualifier("tbGoodsImageDaoImpl")
    private TbGoodsImageDao dao;

    /**
     * 获取一个商品号的所有图片路径
     * @param goodsId
     * @return
     */
    @Override
    public List<TbGoodsImage> getImageByGoodsId(Integer goodsId) {
        return dao.getImageByGoodsId(goodsId);
    }

    /**
     * 删除一条记录
     * @param tbGoodsImage
     * @return
     */
    @Override
    public Boolean deleteGoodsImage(TbGoodsImage tbGoodsImage) {
        return dao.deleteGoodsImage(tbGoodsImage);
    }

    /**
     * 添加一条图片记录
     * @param tbGoodsImage
     * @return
     */
    @Override
    public Boolean addGoodsImage(TbGoodsImage tbGoodsImage) {
        return dao.addGoodsImage(tbGoodsImage);
    }

    /**
     * 修改一条图片记录
     * @param goodsId
     * @param oldImagePath
     * @param newImagePath
     * @return
     */
    @Override
    public Boolean updateGoodsImage(Integer goodsId, String oldImagePath, String newImagePath) {
        return dao.updateGoodsImage(goodsId,oldImagePath,newImagePath);
    }
}
